package com.zlq.cn;

import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.LocalDateTimeUtil;
import com.alibaba.fastjson.JSON;
import com.aliyun.oss.model.OSSObjectSummary;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.zlq.cn.cache.RedisCacheService;
import com.zlq.cn.cache.topic.RedisTopicService;
import com.zlq.cn.config.LieYingConfig;
import com.zlq.cn.entity.*;
import com.zlq.cn.service.exam.ExamAnswersService;
import com.zlq.cn.service.exam.ExamQuestionsService;
import com.zlq.cn.service.juhe.JuheZwTypeService;
import com.zlq.cn.service.movie.MovieCategoryService;
import com.zlq.cn.service.movie.MovieCommentService;
import com.zlq.cn.service.movie.MovieService;
import com.zlq.cn.service.un.*;
import com.zlq.cn.test.VideoTest;
import com.zlq.cn.util.DouBanCommentUtils;
import com.zlq.cn.util.StringUtils;
import okhttp3.HttpUrl;
import one.util.streamex.StreamEx;
import org.apache.commons.io.FilenameUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.scheduling.annotation.EnableScheduling;

import javax.annotation.Resource;
import java.io.File;
import java.io.FileInputStream;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;


@SpringBootApplication
@EnableScheduling
@MapperScan("com.zlq.**.mapper")
public class ZlqApplication extends SpringBootServletInitializer implements ApplicationRunner {
    @Resource
    private IosService iosService;
    @Resource
    private RedisTopicService redisTopicService;
    @Resource
    private RedisCacheService redisCacheService;
    @Resource
    private MovieCategoryService movieCategoryService;
    @Resource
    private MovieService movieService;
    @Resource
    private MovieCommentService movieCommentService;
    @Resource
    private DouBanCommentUtils douBanCommentUtils;
    @Resource
    private LieYingConfig.LieYingApi lieYingApi;
    @Resource
    private LieYingTerminalService lieYingTerminalService;
    @Resource
    private LieYingServiceService lieYingServiceService;
    @Resource
    private UserService userService;
    @Resource
    private XinGaiNianService xinGaiNianService;
    @Resource
    private ConfigService configService;
    @Resource
    private ExamQuestionsService examQuestionsService;
    @Resource
    private ExamAnswersService examAnswersService;

    @Value("${spring.profiles.active}")
    private String active;

    @Resource
    private PushService pushService;

    @Resource
    private JuheZwTypeService juheZwTypeService;

    @Resource
    private ZuowenService zuowenService;

    @Resource
    private ZhTibetanDictService zhTibetanDictService;

    @Resource
    private ZhCommonWordsService zhCommonWordsService;

    @Resource
    private ZhChArticleService zhChArticleService;

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ZlqApplication.class);
    }

    public static void main(String[] args) {
        SpringApplication.run(ZlqApplication.class, args);
        System.out.println("项目启动完毕");
    }

    private static final File VIDEO_TYPE_FILE = new File("C:\\Users\\Administrator\\Desktop\\video_type_new.json");

    @Override
    public void run(ApplicationArguments args) throws Exception {
//        zhChArticleService.pull();
//        zhCommonWordsService.pull();
//        zhTibetanDictService.pull();
//        zuowenService.zuowenti();
//        List<ExamAnswers> examAnswers = new ArrayList<>();
//        List<ExamQuestions> examQuestions = examQuestionsService.lambdaQuery()
//                .eq(ExamQuestions::getType, "0")
//                .list();
//        Map<Integer, List<ExamAnswers>> listAndThen = StreamEx.of(examQuestions).map(ExamQuestions::getQuestionId).toListAndThen(questionIds -> examAnswersService.lambdaQuery()
//                .in(ExamAnswers::getQuestionId, questionIds)
//                .list().stream().collect(Collectors.groupingBy(ExamAnswers::getQuestionId)));
//        for (ExamQuestions examQuestion : examQuestions) {
//            if (!listAndThen.containsKey(examQuestion.getQuestionId())) {
//                examAnswers.add(new ExamAnswers()
//                        .setDbtype("dianli")
//                        .setKey("A")
//                        .setValue("正确")
//                        .setQuestionId(examQuestion.getQuestionId()));
//                examAnswers.add(new ExamAnswers()
//                        .setDbtype("dianli")
//                        .setKey("B")
//                        .setValue("错误")
//                        .setQuestionId(examQuestion.getQuestionId()));
//            }
//        }
//        examAnswersService.saveBatch(examAnswers);

//        String baseUrl = "https://thirtyfairy.oss-cn-shenzhen.aliyuncs.com/";
//        List<OSSObjectSummary> all = configService.listObjects("xingainian");
//        StreamEx.of(all).map(it -> HttpUrl.get(baseUrl + it.getKey()))
//                .filter(httpUrl -> httpUrl.pathSegments().size() == 4 && StringUtils.isNotEmpty(httpUrl.pathSegments().get(3)))
//                .map(httpUrl -> {
//                    List<String> pathSegments = httpUrl.pathSegments();
//                    return new XinGaiNian().setType(pathSegments.get(0)).setBook(pathSegments.get(1)).setFileType(pathSegments.get(2))
//                            .setFileName(pathSegments.get(3)).setFileUrl(httpUrl.toString()).setCreateDate(LocalDateTime.now());
//                })
//                .toListAndThen(xinGaiNianService::saveBatch);
//        String baseFile = "C:\\Users\\14988\\Desktop\\mp4";
//        List<XinGaiNian> list = xinGaiNianService.lambdaQuery()
//                .likeLeft(XinGaiNian::getFileName, ".mp4")
//                .isNull(XinGaiNian::getFileImage)
//                .list();
//        for (XinGaiNian xinGaiNian : list) {
//            HttpUrl httpUrl = HttpUrl.get(xinGaiNian.getFileUrl());
//            String saveFile = baseFile + httpUrl.encodedPath();
//            saveFile = saveFile.replace(".mp4", ".jpg");
//            File parentFile = new File(saveFile).getParentFile();
//            if (!parentFile.exists()) {
//                parentFile.mkdirs();
//            }
//            VideoTest.fetchFrame(xinGaiNian.getFileUrl(), saveFile);
//            String replace = httpUrl.encodedPath().replace(".mp4", ".jpg").substring(1);
//            String s = configService.putObject(replace, new FileInputStream(saveFile));
//            xinGaiNian.setFileImage("https://thirtyfairy.oss-cn-shenzhen.aliyuncs.com/" + s);
//            System.out.println("========" + s);
//        }
//        xinGaiNianService.updateBatchById(list);

//        List<JuheZwType> juheZwTypes = JSON.parseArray("[ { \"name\" : \"小升初\" , \"dataId\" : 17} , { \"name\" : \"六年级\" , \"dataId\" : 16} , { \"name\" : \"三年级\" , \"dataId\" : 13} , { \"name\" : \"五年级\" , \"dataId\" : 15} , { \"name\" : \"初三\" , \"dataId\" : 23} , { \"name\" : \"高考\" , \"dataId\" : 34} , { \"name\" : \"一年级\" , \"dataId\" : 11} , { \"name\" : \"初一\" , \"dataId\" : 21} , { \"name\" : \"中考\" , \"dataId\" : 24} , { \"name\" : \"初二\" , \"dataId\" : 22} , { \"name\" : \"四年级\" , \"dataId\" : 14} , { \"name\" : \"高二\" , \"dataId\" : 32} , { \"name\" : \"高一\" , \"dataId\" : 31} , { \"name\" : \"高三\" , \"dataId\" : 33} , { \"name\" : \"二年级\" , \"dataId\" : 12}]", JuheZwType.class);
//        for (JuheZwType juheZwType : juheZwTypes) {
//            juheZwType.setType(1);
//        }
//        List<JuheZwType> juheZwTypes1 = JSON.parseArray("[ { \"name\" : \"看图\" , \"dataId\" : 34} , { \"name\" : \"游记\" , \"dataId\" : 31} , { \"name\" : \"叙事\" , \"dataId\" : 12} , { \"name\" : \"其他\" , \"dataId\" : 40} , { \"name\" : \"状物\" , \"dataId\" : 14} , { \"name\" : \"诗歌\" , \"dataId\" : 29} , { \"name\" : \"写人\" , \"dataId\" : 11} , { \"name\" : \"写景\" , \"dataId\" : 13} , { \"name\" : \"童话\" , \"dataId\" : 25} , { \"name\" : \"散文\" , \"dataId\" : 26} , { \"name\" : \"议论文\" , \"dataId\" : 15} , { \"name\" : \"读后感\" , \"dataId\" : 21} , { \"name\" : \"日记\" , \"dataId\" : 18} , { \"name\" : \"寓言\" , \"dataId\" : 28} , { \"name\" : \"说明文\" , \"dataId\" : 16} , { \"name\" : \"读书笔记\" , \"dataId\" : 32} , { \"name\" : \"话题\" , \"dataId\" : 36} , { \"name\" : \"想象\" , \"dataId\" : 35} , { \"name\" : \"演讲稿\" , \"dataId\" : 22} , { \"name\" : \"应用文\" , \"dataId\" : 50} , { \"name\" : \"书信\" , \"dataId\" : 17} , { \"name\" : \"小说\" , \"dataId\" : 24}]", JuheZwType.class);
//        for (JuheZwType juheZwType : juheZwTypes1) {
//            juheZwType.setType(2);
//        }
//        List<JuheZwType> juheZwTypes2 = JSON.parseArray("[ { \"name\" : \"700字\" , \"dataId\" : 14} , { \"name\" : \"1200字以上\" , \"dataId\" : 20} , { \"name\" : \"1200字\" , \"dataId\" : 19} , { \"name\" : \"300字\" , \"dataId\" : 6} , { \"name\" : \"200字\" , \"dataId\" : 4} , { \"name\" : \"600字\" , \"dataId\" : 12} , { \"name\" : \"100字\" , \"dataId\" : 2} , { \"name\" : \"500字\" , \"dataId\" : 10} , { \"name\" : \"1000字\" , \"dataId\" : 18} , { \"name\" : \"800字\" , \"dataId\" : 16} , { \"name\" : \"400字\" , \"dataId\" : 8}]", JuheZwType.class);
//        for (JuheZwType juheZwType : juheZwTypes2) {
//            juheZwType.setType(3);
//        }
//        juheZwTypes.addAll(juheZwTypes1);
//        juheZwTypes.addAll(juheZwTypes2);
//        List<JuheZwType> juheZwTypes3 = JSON.parseArray("[ { \"dataId\" : 4 , \"name\" : \"优\"} , { \"dataId\" : 3 , \"name\" : \"良\"} , { \"dataId\" : 2 , \"name\" : \"中\"} , { \"dataId\" : 1 , \"name\" : \"差\"}]", JuheZwType.class);
//        for (JuheZwType juheZwType : juheZwTypes3) {
//            juheZwType.setType(4);
//        }
//        juheZwTypes.addAll(juheZwTypes3);
//        juheZwTypeService.saveBatch(juheZwTypes);
//        redisTopicService.aliPushBatteryWarningConvertAndSend(redisCacheService.get(RedisKey.createUserKey("42")));
//        iosService.buyAppVerify("1000000760824472","MIIUCgYJKoZIhvcNAQcCoIIT+zCCE/cCAQExCzAJBgUrDgMCGgUAMIIDqwYJKoZIhvcNAQcBoIIDnASCA5gxggOUMAoCAQgCAQEEAhYAMAoCARQCAQEEAgwAMAsCAQECAQEEAwIBADALAgEDAgEBBAMMATEwCwIBCwIBAQQ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b0OtJ8NT56e4aJx9ry4azQPTPpLBvI2mgj5IxJOalq0/9Nlt60nmtvM+meQbPwnr3nIYIEsOdNBtvdcwPA6Jthe8QZHJoxCHcY58tnT1FVzp3td/ruV104RkmKbOKjeFicT5mUie8ZBZpadIUBLk9JjEzUSy/nsaWL1t4qThcV9TaTHt2Aux0l9jyFT0v/oR6ncq849laXdySjl3y6oT8pUFMFDqdikQQxhKRoKHV7zpTe3uNf461pXoKk9406AIC13APxP1JnYjXFRgA6YFA==");
        // redisCacheService.set(RedisKey.createUserOnline(31), "2222", 5);

//        List<MovieCategory> videoTypes = JSON.parseArray(FileUtils.readFileToString(VIDEO_TYPE_FILE, StandardCharsets.UTF_8), MovieCategory.class);
//        movieCategoryService.saveBatch(videoTypes);
//        StreamEx.of(videoTypes)
//                .flatMap(movieCategory -> {
//                    movieCategory.getVideoInfos().forEach(movie -> {
//                        movie.setMovieCategoryId(movieCategory.getMovieCategoryId());
//                        movie.setStatus(1);
//                    });
//                    return StreamEx.of(movieCategory.getVideoInfos());
//                })
//                .toListAndThen(movieService::saveBatch);
//        StreamEx.of(videoTypes)
//                .map(MovieCategory::getVideoInfos)
//                .flatMap(Collection::stream)
//                .filter(movie -> CollectionUtils.isNotEmpty(movie.getComments()))
//                .flatMap(movie -> {
//                    movie.getComments().forEach(comment -> {
//                        comment.setMovieId(movie.getMovieId());
//                    });
//                    return StreamEx.of(movie.getComments());
//                })
//                .toListAndThen(movieCommentService::saveBatch);
//        System.out.println(videoTypes);

//        douBanCommentUtils.parse();
//
//        List<Integer> userIds = lieYingTerminalService.lambdaQuery()
//                .eq(LieYingTerminal::getProject, Config.PROJECT_LOVERS)
//                .list().stream()
//                .map(LieYingTerminal::getUserId)
//                .collect(Collectors.toList());
//        Integer sid = lieYingServiceService.lambdaQuery().eq(LieYingService::getProject, Config.PROJECT_LOVERS).one().getSid();
//        userService.lambdaQuery()
//                .eq(User::getProject, Config.PROJECT_LOVERS)
//                .list()
//                .stream()
//                .filter(user -> !userIds.contains(user.getId()))
//                .forEach(user -> {
//                    System.out.println(user);
//                    System.out.println(String.format("%s_%s", active, user.getId()));
//                    LieYingTerminal lieYingTerminal = null;
//                    try {
//                        lieYingTerminal = lieYingApi.terminalAdd(Config.LIE_YING_LOVERS, sid, String.format("%s_%s", active, user.getId())).execute().body().getData()
//                                .setSid(sid)
//                                .setUserId(user.getId())
//                                .setProject(Config.PROJECT_LOVERS);
//                    } catch (Exception e) {
//                        e.printStackTrace();
//                    }
//                    lieYingTerminalService.save(lieYingTerminal);
//                });
        //pushService.pushAccount(Config.PROJECT_LOVERS, 54, "title", "body",  null);
    }
}
